<include file="Public:header2"/>

<div class="main">
    <div class="box_m">

        <include file="Public:main_left2"/>

        <div class="main_r">

            <div class="main_r_t">
                修改信息
            </div>
            <div class="main_r_c">
                <div class="form_ul">
                    <form action="{:U('Index/dobanner_edit')}" method="post" >
                        <input type="hidden" name="id" value="{$banner_edit.id}">
                        
                        <div class="form_li">
                            <div class="form_li_l">banner标题：</div>
                            <div class="form_li_r">
                                <input type="text" class="input_text" name="title" value="{$banner_edit.title}" />
                            </div>
                            <div class="clear"></div>
                        </div>
                        <div class="form_li">
                            <div class="form_li_l">链接地址：</div>
                            <div class="form_li_r">
                                 <input type="text" class="input_text" name="to_url" value="{$banner_edit.to_url}" />
                            </div>
                            <div class="clear"></div>
                        </div>
                        <div class="form_li">
                            <div class="form_li_l">图片上传：</div>
                            <div class="form_li_r">
                            	<img id="video_url" src="{$banner_edit.url}" width="300" >
                                <input type="file" id="video_url_file" name="img" >
                                <input type="hidden" id="video_url_save" name="url" >
                            </div>
                            <div class="clear"></div>
                        </div>
                        <div class="form_li">
                            <div class="form_li_l">&nbsp;</div>
                            <div class="form_li_r">
                                <input type="submit" class="form_btn">
                            </div>
                            <div class="clear"></div>
                        </div>
                    </form>
                </div>
            </div>

        </div>


        <div class="clear"></div>
    </div>
</div>

<script language="javascript">

	
	$(function(){
		$("#video_url_file").on("change",function(){
			do_upload();
		})
	})
	
	function do_upload(){
		var form = new FormData();
		var img=$("#video_url_file").get(0).files[0];
		form.append("img",img);
		$.ajax({
            url:"__JS__/action.php",
            type:'POST',
            data:form,
            processData:false,
            contentType:false,
            success:function(data){
            	var jsonData = jQuery.parseJSON(data);
                $("#video_url").attr("src",jsonData.pic_path)
                $("#video_url_save").val(jsonData.pic_path)
            },
            error:function(e){
                alert("错误！！");
            }
        });
	}
</script>

<include file="Public:bottom"/>